<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="HaveReadDocumentBrowseYes.aspx.cs" Inherits="M_Main.OAPublicWorkNew.HaveReadDocumentBrowseYes" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>我的文档-已读文档</title>
    <script type="text/javascript" src="../jscript/jquery-1.11.3.min.js"></script>
    <script src="../jscript/jquery.tool.new.js" type="text/javascript"></script>
    <script src="../jscript/Dialog.js" type="text/javascript"></script>
    <link rel="stylesheet" type="text/css" href="../Jscript-Ui/jquery-easyui-1.4.4/themes/default/easyui.css" />
    <link rel="stylesheet" type="text/css" href="../Jscript-Ui/jquery-easyui-1.4.4/themes/icon.css" />
    <script type="text/javascript" src="../Jscript-Ui/jquery-easyui-1.4.4/jquery.easyui.min.js"></script>
    <script type="text/javascript" src="../Jscript-Ui/jquery-easyui-1.4.4/locale/easyui-lang-zh_CN.js"></script>
    <link href="../css/framesearch.css" type="text/css" rel="stylesheet" />
    <script type="text/javascript" src="../jscript/export.js"></script>
    <style type="text/css">
        #SearchDlg {
            padding: 10px;
            width: 700px;
            height: 200px;
        }

        .SearchTable {
            width: 700px;
            height: auto;
        }

            .SearchTable .TdTitle {
                width: 15%;
            }

            .SearchTable .TdContent {
                width: 35%;
            }
    </style>
</head>
<body>
    <form id="frmForm" runat="server">
        <input id="WorkFlowTypeId" type="hidden" name="WorkFlowTypeId" runat="server" />
        <input id="CorpID" type="hidden" name="CorpID" runat="server" />
        <input id="IsRead" type="hidden" name="IsRead" value="1" runat="server" />
        <div id="TableContainer"></div>
        <div id="SearchDlg" class="easyui-dialog" title="筛选条件" style="overflow: hidden;" data-options="iconCls:'icon-search',closed: true,modal:true">
            <table class="SearchTable">
                <tr>
                    <td class="TdTitle">流程类别
                    </td>
                    <td class="TdContent">
                        <select id="WorkFlowType" name="WorkFlowType" style="height: 28px;">
                            <option value="">所有流程</option>
                            <option value="0002">公文管理</option>
                            <option value="0003">会议审批</option>
                            <option value="0004">合同评审</option>
                            <option value="0005">报账审批</option>
                            <option value="0006">借款审批</option>
                            <option value="0007">请假审批</option>
                            <option value="0008">派车审批</option>
                            <option value="0009">工作交办</option>
                            <option value="0010">工作呈报</option>
                            <option value="0011">采购计划</option>
                            <option value="0012">人事审批</option>
                            <option value="0013">资产报损</option>
                            <option value="0014">资产申购</option>
                            <%--<option value="0016">发文审批</option>
                                <option value="0017">收文审批</option>
                                <option value="0018">会议预订</option>
                                <option value="0019">工作呈报</option>
                                <option value="0020">工作联系</option>--%>
                        </select>
                    </td>
                    <td class="TdTitle">发起人
                    </td>
                    <td class="TdContent">
                        <input type="text" id="DraftUserName" name="DraftUserName" runat="server" />
                    </td>
                </tr>
                <tr>
                    <td class="TdTitle">文件标题
                    </td>
                    <td class="TdContent">
                        <input id="FileTitle" name="FileTitle" runat="server" />
                    </td>
                    <td class="TdTitle">发文部门
                    </td>
                    <td class="TdContent">
                        <input id="SendCompany" name="SendCompany" runat="server" />
                    </td>
                </tr>
                <tr>
                    <td class="TdTitle">发起开始时间
                    </td>
                    <td class="TdContentSearch">
                        <input id="CheckStartDate" name="CheckStartDate" class="easyui-datebox" runat="server" />
                    </td>
                    <td class="TdTitle">发起结束时间
                    </td>
                    <td class="TdContentSearch">
                        <input id="CheckEndDate" name="CheckEndDate" class="easyui-datebox" runat="server" />
                    </td>
                </tr>
                <tr>
                    <td colspan="4" style="text-align: center; padding-top: 5px;">
                        <a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-search'" onclick="LoadList();">确定筛选</a>
                    </td>
                </tr>
            </table>
        </div>
        <script src="../jscript/CloseAjaxCache.js" type="text/javascript"></script>
        <script type="text/javascript">
            function InitFunction() {
                var h = $(window).height();
                $("#TableContainer").css("height", h + "px");
                //只针对天投使用的代码 请不要删除
                if ($('#CorpID').val() == '1000' || $('#CorpID').val() == '1829') {
                    $("#WorkFlowType").append("<option value='0016'>发文审批</option>");
                    $("#WorkFlowType").append("<option value='0017'>收文审批</option>");
                    $("#WorkFlowType").append("<option value='0018'>会议预订</option>");
                    $("#WorkFlowType").append("<option value='0019'>工作呈报</option>");
                    $("#WorkFlowType").append("<option value='0020'>工作联系</option>");
                }

            }
            InitFunction();
            var column;
            column = [[
                { field: 'WFTypeName', title: '文件类别', align: 'left', width: 30, sortable: true },
                { field: 'FileCode', title: '文件编号', align: 'left', width: 50, sortable: true },
                {
                    field: 'FName', title: '文件名称', align: 'left', width: 120, sortable: true, formatter: function (value, row, index) {
                        var str = "<a class=\"HrefStyle\" href=\"#\" onclick=\"Detail('" + row.InstanceInfoId + "','" + row.WorkFlowTypeName + "');\">" + row.FName + "</a>";
                        return str;
                    }
                },
                { field: 'SendCompany', title: '发文单位', align: 'left', width: 50, sortable: true },
                { field: 'DraftUserName', title: '发起人', align: 'left', width: 80, sortable: true },
                { field: 'ThemeDate', title: '成文时间', align: 'left', width: 50, sortable: true }

            ]];
            var toolbar = [
                {
                    text: '删除',
                    iconCls: 'icon-cancel',
                    handler: function () {
                        var row = $("#TableContainer").datagrid("getSelected");
                        DelRecord(row)
                    }
                }, '-',
                {
                    text: '筛选',
                    iconCls: 'icon-filter',
                    handler: function () {
                        $('#SearchDlg').parent().appendTo($("form:first"));
                        $('#SearchDlg').dialog('open');
                    }
                }, '-',
                {
                    text: '导出Excel',
                    iconCls: 'icon-page_excel',
                    handler: function () {
                        var rowData = $('#TableContainer').datagrid('getData');
                        if (rowData.total == 0) {
                            HDialog.Info('没有可导出的数据');
                        }
                        else {
                            Export('已读文档Excel', $('#TableContainer'));
                        }
                    }
                }
            ];

            function Export(strXlsName, exportGrid) {
                var f = $('<form action="../export.aspx" method="post" id="fm1"></form>');
                var i = $('<input type="hidden" id="txtContent" name="txtContent" />');
                var l = $('<input type="hidden" id="txtName" name="txtName" />');
                i.val(ChangeToTable3(exportGrid, Headcolumn, ExcelCol));
                i.appendTo(f);
                l.val(strXlsName);
                l.appendTo(f);
                f.appendTo(document.body).submit();
                document.body.removeChild(f);
            }

            var Headcolumn = [[
                { field: 'WFTypeName', title: '文件类别', align: 'left', width: 150, sortable: true },
                { field: 'FileCode', title: '文件编号', align: 'left', width: 150, sortable: true },
                { field: 'FName', title: '文件名称', align: 'left', width: 200, sortable: true },
                { field: 'SendCompany', title: '发文单位', align: 'left', width: 200, sortable: true },
                { field: 'DraftUserName', title: '发起人', align: 'left', width: 200, sortable: true },
                { field: 'ThemeDate', title: '成文时间', align: 'left', width: 120, sortable: true }
            ]];
            var ExcelCol = [
                { field: 'WFTypeName', title: '文件类别', align: 'left', width: 150, sortable: true },
                { field: 'FileCode', title: '文件编号', align: 'left', width: 150, sortable: true },
                { field: 'FName', title: '文件名称', align: 'left', width: 200, sortable: true },
                { field: 'SendCompany', title: '发文单位', align: 'left', width: 200, sortable: true },
                { field: 'DraftUserName', title: '发起人', align: 'left', width: 200, sortable: true },
                { field: 'ThemeDate', title: '成文时间', align: 'left', width: 120, sortable: true }
            ];


            function DelRecord(row) {
                $.messager.confirm('确定', '是否删除该项', function (r) {
                    if (r) {
                        $.tool.DataGet('OASearch', 'MyDocumentListDelete', 'InfoId=' + row.InfoId,
                            function Init() {
                            },
                            function callback(_Data) {
                                $('#SearchDlg').parent().appendTo($("form:first"));
                                if (_Data.substring(0, 5) == "false") {
                                    HDialog.Info(_Data.substring(6));
                                }
                                else {
                                    LoadList();
                                }
                            },
                            function completeCallback() {
                            },
                            function errorCallback() {
                            });
                    }
                });
            }

            function LoadList() {
                $("#TableContainer").datagrid({
                    url: '/HM/M_Main/HC/DataGetControl.aspx?Method=DataGet&Class=OASearch&Command=MyDocumentListSearch_HasRead&' + $('#frmForm').serialize(),
                    method: "get",
                    nowrap: false,
                    pageSize: top.ListPageSize,
                    pageList: top.ListPageList,
                    columns: column,
                    fitColumns: true,
                    singleSelect: true,
                    pagination: true,
                    remoteSort: false,
                    rownumbers: true,
                    width: "100%",
                    toolbar: toolbar,
                    border: false,
                    sortOrder: "asc",
                    onLoadSuccess: function (data) {
                        $("#SearchDlg").dialog("close");
                    }
                });
            }
            LoadList();

            function Detail(InfoId, WorkFlowTypeName) {
                if (InfoId == '') {
                }
                else {
                    if (WorkFlowTypeName == "0002") {
                        //公文管理
                        window.location.href = "OfficialDocumentManage.aspx?InfoId=" + InfoId + "&IsPrint=1";
                    } else if (WorkFlowTypeName == "0003") {
                        //会议审批
                        window.location.href = "OfficiaConferenceManage.aspx?InfoId=" + InfoId + "&IsPrint=1";
                    } else if (WorkFlowTypeName == "0004") {
                        //合同评审
                        window.location.href = "ContractManage.aspx?InfoId=" + InfoId + "&IsPrint=1";
                    } else if (WorkFlowTypeName == "0005") {
                        //报账审批
                        window.location.href = "ReimbursementManage.aspx?InfoId=" + InfoId + "&IsPrint=1";
                    } else if (WorkFlowTypeName == "0006") {
                        //借款审批
                        window.location.href = "BorrowerMoneyManage.aspx?InfoId=" + InfoId + "&IsPrint=1";
                    } else if (WorkFlowTypeName == "0007") {
                        //请假审批
                        window.location.href = "AskForLeaveManage.aspx?InfoId=" + InfoId + "&IsPrint=1";
                    } else if (WorkFlowTypeName == "0008") {
                        //派车审批
                        window.location.href = "SendCarManage.aspx?InfoId=" + InfoId + "&IsPrint=1";
                    } else if (WorkFlowTypeName == "0009") {
                        //工作交办
                        window.location.href = "WorkContactManage.aspx?InfoId=" + InfoId + "&IsPrint=1";
                    } else if (WorkFlowTypeName == "0010") {
                        //工作呈报
                        window.location.href = "WorkContactReportManage.aspx?InfoId=" + InfoId + "&IsPrint=1";
                    } else if (WorkFlowTypeName == "0011") {
                        //采购计划
                        window.location.href = "BuyPlanCheckManage.aspx?InfoId=" + InfoId + "&IsPrint=1";
                    } else if (WorkFlowTypeName == "0012") {
                        //人事审批
                        window.location.href = "InsuranceCheckManage.aspx?InfoId=" + InfoId + "&IsPrint=1";
                    } else if (WorkFlowTypeName == "0013") {
                        //资产报损
                        window.location.href = "FixedAssetsLossTableManage.aspx?InfoId=" + InfoId + "&IsPrint=1";
                    } else if (WorkFlowTypeName == "0014") {
                        //资产申购
                        window.location.href = "MaterialBuyPlanManage.aspx?InfoId=" + InfoId + "&IsPrint=1";
                    } else if (WorkFlowTypeName == "0015") {
                        //业务流程
                        //window.location.href = "OfficialDocumentManage.aspx?InfoId=" + InfoId + "&IsPrint=1";
                    } else if (WorkFlowTypeName == "0016") {
                        //发文审批
                        window.location.href = "DocumentApprovalManage.aspx?InfoId=" + InfoId + "&IsPrint=1";
                    } else if (WorkFlowTypeName == "0017") {
                        //收文审批
                        window.location.href = "OfficialDocumentManage_NewAddTt.aspx?InfoId=" + InfoId + "&IsPrint=1";
                    } else if (WorkFlowTypeName == "0018") {
                        //会议预订
                        window.location.href = "MeetingReservation_Add.aspx?InfoId=" + InfoId + "&IsPrint=1";
                    } else if (WorkFlowTypeName == "0019") {
                        //工作呈报
                        window.location.href = "WorkReport_TTManage.aspx?InfoId=" + InfoId + "&IsPrint=1";
                    } else if (WorkFlowTypeName == "0020") {
                        //工作联系
                        window.location.href = "JobConnectionManage.aspx?InfoId=" + InfoId + "&IsPrint=1";
                    }
                }
            }
        </script>
    </form>
</body>
</html>
