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

<!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-Ui/jquery-easyui-1.4.1/jquery.min.js"></script>
    <script language="javascript" src="../jscript/jquery.tool.js" type="text/javascript"></script>
    <link href="../css/style.css" type="text/css" rel="stylesheet">
    <link rel="stylesheet" type="text/css" href="../Jscript-Ui/jquery-easyui-1.4.1/themes/default/easyui.css">
    <link rel="stylesheet" type="text/css" href="../Jscript-Ui/jquery-easyui-1.4.1/themes/icon.css">
    <script type="text/javascript" src="../Jscript-Ui/jquery-easyui-1.4.1/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 rel="stylesheet" type="text/css" href="../Jscript-Ui/jquery-easyui-1.4.1/demo/demo.css">--%>
    <script language="javascript" src="../jscript/JSClient.js" type="text/javascript"></script>
    <link href="../css/framesearch.css" type="text/css" rel="stylesheet" />
    <script src="../Jscript-Ui/hplus/js/plugins/layer/layer.min.js"></script>
    <script src="../jscript/Dialog.js" type="text/javascript"></script>
    <style>
        .Td {
            height: 16px;
            width: 20%;
            text-align: right;
        }

        .TContent {
            height: 16px;
            width: 25%;
            margin-left: 15px;
            padding-left: 15px;
            text-align: left;
        }

        a {
            text-decoration: underline;
        }
    </style>
</head>
<body>
    <form id="FrmFrom" runat="server">
        <input type="hidden" id="TypeCode" name="TypeCode" runat="server" />
        <input type="hidden" id="ReturnValue" name="ReturnValue" />
        <div style="width: 100%; background-color: #cccccc;" id="TableContainer"></div>
        <div id="SearchDlg1" class="easyui-dialog" title="筛选条件" data-options="iconCls:'icon-search',closed: true,modal:true" style="width: 530px; height: 110px; overflow: hidden; padding: 10px;">
            <table style="width: 100%; font-size: 12px; font-family: 微软雅黑;">
                <tr>
                    <td class="Td">供方类别</td>
                    <td class="TContent">
                        <select name="SupplierType" id="SupplierType" style="width: 98%;" class="easyui-validatebox" runat="server">
                        </select>
                    </td>
                    <td class="Td">流程名称</td>
                    <td class="TContent">
                        <input id="WorkFlowIdName1" name="WorkFlowIdName1" onclick="WorkFlowChoise('1');" class="easyui-validatebox" style="width: 130px;" />
                    </td>
                </tr>
                <tr>
                    <td colspan="4" align="center"></td>
                </tr>
                <tr>
                    <td colspan="4" align="center"><a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-search'" onclick="LoadList();">确定筛选</a>

                        <a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-reload'"
                            onclick="btnClear();">清空</a>
                    </td>
                </tr>
            </table>
        </div>
        <!--2-->
        <div id="SearchDlg2" class="easyui-dialog" title="筛选条件" data-options="iconCls:'icon-search',closed: true,modal:true" style="width: 530px; height: 141px; overflow: hidden; padding: 10px;">
            <table style="width: 100%; font-size: 12px; font-family: 微软雅黑;">
                <tr>
                    <td class="Td">
                        <label id="ContractType">合同类型</label></td>
                    <td class="TContent">
                        <select name="ContractId" id="ContractId" style="width: 98%;" class="easyui-validatebox" runat="server">
                        </select>
                    </td>
                    <td class="Td">流程名称</td>
                    <td class="TContent">
                        <input id="WorkFlowIdName2" name="WorkFlowIdName2" onclick="WorkFlowChoise('2');" class="easyui-validatebox" style="width: 130px;" />
                    </td>
                </tr>
                <tr>
                    <td colspan="4" align="center"></td>
                </tr>
                <tr>
                    <td class="Td">合同金额</td>
                    <td class="TContent">
                        <input id="ContractMoneyStart" name="ContractMoneyStart" class="easyui-numberbox" min="0.0001" precision="4" />
                    </td>
                    <td class="Td">至</td>
                    <td class="TContent">
                        <input id="ContractMoneyEnd" name="ContractMoneyEnd" class="easyui-numberbox" min="0.0001" precision="4" />
                    </td>
                </tr>
                <tr>
                    <td colspan="4" align="center"></td>
                </tr>
                <tr>
                    <td colspan="4" align="center"><a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-search'" onclick="LoadList();">确定筛选</a>

                        <a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-reload'"
                            onclick="btnClear();">清空</a>
                    </td>
                </tr>
            </table>
        </div>
        <!--2-->
        <!--3-->
        <div id="SearchDlg3" class="easyui-dialog" title="筛选条件" data-options="iconCls:'icon-search',closed: true,modal:true" style="width: 530px; height: 141px; overflow: hidden; padding: 10px;">
            <table style="width: 100%; font-size: 12px; font-family: 微软雅黑;">
                <tr>
                    <td class="Td">计划金额</td>
                    <td class="TContent">
                        <input id="PlanMoneyStart" name="PlanMoneyStart" class="easyui-numberbox" min="0.0001" precision="4" />
                    </td>
                    <td class="Td">至</td>
                    <td class="TContent">
                        <input id="PlanMoneyEnd" name="PlanMoneyEnd" class="easyui-numberbox" min="0.0001" precision="4" />
                    </td>
                </tr>
                <tr>
                    <td colspan="4" align="center"></td>
                </tr>
                <tr>
                    <td class="Td">流程名称</td>
                    <td class="TContent">
                        <input id="WorkFlowIdName3" name="WorkFlowIdName3" onclick="WorkFlowChoise('3');" class="easyui-validatebox" style="width: 130px;" />

                    </td>
                    <td class="Td"></td>
                    <td class="TContent"></td>
                </tr>
                <tr>
                    <td colspan="4" align="center"></td>
                </tr>
                <tr>
                    <td colspan="4" align="center"><a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-search'" onclick="LoadList();">确定筛选</a>

                        <a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-reload'"
                            onclick="btnClear();">清空</a>
                    </td>
                </tr>
            </table>
        </div>
        <!--3-->
        <!--4-->
        <div id="SearchDlg4" class="easyui-dialog" title="筛选条件" data-options="iconCls:'icon-search',closed: true,modal:true" style="width: 530px; height: 141px; overflow: hidden; padding: 10px;">
            <table style="width: 100%; font-size: 12px; font-family: 微软雅黑;">
                <tr>
                    <td class="Td">请付类型</td>
                    <td class="TContent">
                        <select name="PaymentType" id="PaymentType" class="easyui-validatebox" style="width: 99%;">
                        </select>
                    </td>
                    <td class="Td">流程名称</td>
                    <td class="TContent">
                        <input id="WorkFlowIdName4" name="WorkFlowIdName4" class="easyui-validatebox" onclick="WorkFlowChoise('4');" />
                    </td>
                </tr>
                <tr>
                    <td colspan="4" align="center"></td>
                </tr>
                <tr>
                    <td class="Td">请付金额</td>
                    <td class="TContent">
                        <input id="PaymentMoneyStart" name="PaymentMoneyStart" class="easyui-numberbox" min="0.0001" precision="4" />
                    </td>
                    <td class="Td">至</td>
                    <td class="TContent">
                        <input id="PaymentMoneyEnd" name="PaymentMoneyEnd" class="easyui-numberbox" min="0.0001" precision="4" />
                    </td>
                </tr>
                <tr>
                    <td colspan="4" align="center"></td>
                </tr>
                <tr>
                    <td colspan="4" align="center"><a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-search'" onclick="LoadList();">确定筛选</a>

                        <a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-reload'"
                            onclick="btnClear();">清空</a>
                    </td>
                </tr>
            </table>
        </div>
        <!--4-->
        <!--5-->
        <div id="SearchDlg5" class="easyui-dialog" title="筛选条件" data-options="iconCls:'icon-search',closed: true,modal:true" style="width: 530px; height: 141px; overflow: hidden; padding: 10px;">
            <table style="width: 100%; font-size: 12px; font-family: 微软雅黑;">
                <tr>
                    <td class="Td">借款类型</td>
                    <td class="TContent">
                        <select name="LoanType" id="LoanType" class="easyui-validatebox" style="width: 99%;">
                        </select>
                    </td>
                    <td class="Td">流程名称</td>
                    <td class="TContent">
                        <input id="WorkFlowIdName5" name="WorkFlowIdName5" class="easyui-validatebox" onclick="WorkFlowChoise('5');" />
                    </td>
                </tr>
                <tr>
                    <td colspan="4" align="center"></td>
                </tr>
                <tr>
                    <td class="Td">借款金额</td>
                    <td class="TContent">
                        <input id="LoanMoneyStart" name="LoanMoneyStart" class="easyui-numberbox" min="0.0001" precision="4" />
                    </td>
                    <td class="Td">至</td>
                    <td class="TContent">
                        <input id="LoanMoneyEnd" name="LoanMoneyEnd" class="easyui-numberbox" min="0.0001" precision="4" />
                    </td>
                </tr>
                <tr>
                    <td colspan="4" align="center"></td>
                </tr>
                <tr>
                    <td colspan="4" align="center"><a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-search'" onclick="LoadList();">确定筛选</a>

                        <a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-reload'"
                            onclick="btnClear();">清空</a>
                    </td>
                </tr>
            </table>
        </div>
        <!--5-->
        <!-- 6 -->
        <div id="SearchDlg6" class="easyui-dialog" title="筛选条件" data-options="iconCls:'icon-search',closed: true,modal:true" style="width: 530px; height: 141px; overflow: hidden; padding: 10px;">
            <table style="width: 100%; font-size: 12px; font-family: 微软雅黑;">
                <tr>
                    <td class="Td">流程名称</td>
                    <td class="TContent">
                        <input id="WorkFlowIdName6" name="WorkFlowIdName6" class="easyui-validatebox" onclick="WorkFlowChoise('6');" />
                    </td>
                    <td class="Td">单位</td>
                    <td class="TContent">
                        <input name="CastName6" id="CastName6" class="easyui-validatebox" style="width: 99%;" />
                    </td>
                </tr>
                <tr>
                    <td colspan="4" align="center"></td>
                </tr>
                <tr>
                    <td colspan="4" align="center"><a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-search'" onclick="LoadList();">确定筛选</a>

                        <a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-reload'"
                            onclick="btnClear();">清空</a>
                    </td>
                </tr>
            </table>
        </div>
        <!-- 6 -->
        <!-- 7 -->
        <div id="SearchDlg7" class="easyui-dialog" title="筛选条件" data-options="iconCls:'icon-search',closed: true,modal:true" style="width: 530px; height: 141px; overflow: hidden; padding: 10px;">
            <table style="width: 100%; font-size: 12px; font-family: 微软雅黑;">
                <tr>
                    <td class="Td">流程名称</td>
                    <td class="TContent">
                        <input id="WorkFlowIdName7" name="WorkFlowIdName7" class="easyui-validatebox" onclick="WorkFlowChoise('7');" />
                    </td>
                    <td class="Td">单位</td>
                    <td class="TContent">
                        <input name="CastName7" id="CastName7" class="easyui-validatebox" style="width: 99%;" />
                    </td>
                </tr>
                <tr>
                    <td colspan="4" align="center"></td>
                </tr>
                <tr>
                    <td colspan="4" align="center"><a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-search'" onclick="LoadList();">确定筛选</a>

                        <a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-reload'"
                            onclick="btnClear();">清空</a>
                    </td>
                </tr>
            </table>
        </div>
        <!-- 7 -->
        <!-- 8 -->
        <div id="SearchDlg8" class="easyui-dialog" title="筛选条件" data-options="iconCls:'icon-search',closed: true,modal:true" style="width: 530px; height: 141px; overflow: hidden; padding: 10px;">
            <table style="width: 100%; font-size: 12px; font-family: 微软雅黑;">
                <tr>
                    <td class="Td">流程名称</td>
                    <td class="TContent">
                        <input id="WorkFlowIdName8" name="WorkFlowIdName8" class="easyui-validatebox" onclick="WorkFlowChoise('8');" />
                    </td>
                    <td class="Td">单位</td>
                    <td class="TContent">
                        <input name="CastName8" id="CastName8" class="easyui-validatebox" style="width: 99%;" />
                    </td>
                </tr>
                <tr>
                    <td colspan="4" align="center"></td>
                </tr>
                <tr>
                    <td colspan="4" align="center"><a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-search'" onclick="LoadList();">确定筛选</a>

                        <a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-reload'"
                            onclick="btnClear();">清空</a>
                    </td>
                </tr>
            </table>
        </div>
        <!-- 8 -->
        <input type="hidden" id="WorkFlowId" name="WorkFlowId" />
        <script language="javascript" type="text/javascript">
            //监听键盘回车事件
            document.onkeydown = function (event) {
                var e = event || window.event || arguments.callee.caller.arguments[0];
                if (e && e.keyCode == 13) { // enter 键
                    LoadList();
                }
            };
            function InitSelect() {
                $.tool.DataPostAsync('CsCost', 'BindDictionary', 'DcTypeName=请付类型',
                    function Init() {
                    },
                    function callback(_Data) {
                        varObjects = eval("(" + _Data.replace(/\\/g, "/") + ")"); //转换为json对象
                        var option = "<option value=''></option>";
                        $("#PaymentType").append(option);
                        for (var i = 0; i < varObjects.length; i++) {
                            option = "<option value='" + varObjects[i].Id + "'>" + varObjects[i].Name + "</option>";
                            $("#PaymentType").append(option);
                        }
                    },
                    function completeCallback() {
                    },
                    function errorCallback() {
                    }, false);

                $.tool.DataPostAsync('CsCost', 'BindDictionary', 'DcTypeName=借款类型',
                    function Init() {
                    },
                    function callback(_Data) {
                        varObjects = eval("(" + _Data.replace(/\\/g, "/") + ")"); //转换为json对象
                        var option = "<option value=''></option>";
                        $("#LoanType").append(option);
                        for (var i = 0; i < varObjects.length; i++) {
                            option = "<option value='" + varObjects[i].Id + "'>" + varObjects[i].Name + "</option>";
                            $("#LoanType").append(option);
                        }
                    },
                    function completeCallback() {
                    },
                    function errorCallback() {
                    }, false);
                if ($("#TypeCode").val() == "0702") {
                    $.tool.DataPostAsync('CsCost', 'BindDictionary', 'DcTypeName=合同变更类型',
                        function Init() {
                        },
                        function callback(_Data) {
                            varObjects = eval("(" + _Data.replace(/\\/g, "/") + ")"); //转换为json对象
                            var option = "<option value=''></option>";
                            $("#ContractId").append(option);
                            for (var i = 0; i < varObjects.length; i++) {
                                option = "<option value='" + varObjects[i].Id + "'>" + varObjects[i].Name + "</option>";
                                $("#ContractId").append(option);
                            }
                        },
                        function completeCallback() {
                        },
                        function errorCallback() {
                        }, false);
                } else {
                    $.tool.DataPostAsync('CsCost', 'BindDictionary', 'DcTypeName=合同类型',
                        function Init() {
                        },
                        function callback(_Data) {
                            varObjects = eval("(" + _Data.replace(/\\/g, "/") + ")"); //转换为json对象
                            var option = "<option value=''></option>";
                            $("#ContractId").append(option);
                            for (var i = 0; i < varObjects.length; i++) {
                                option = "<option value='" + varObjects[i].Id + "'>" + varObjects[i].Name + "</option>";
                                $("#ContractId").append(option);
                            }
                        },
                        function completeCallback() {
                        },
                        function errorCallback() {
                        }, false);
                }
            }
            InitSelect();
            function WorkFlowChoise(str) {
                var strPage = "../OAWorkFlowNew/FlowSortManageSel.aspx?DirectionaryCode=0015&Filter=" + $("#TypeCode").val() + "&random=" + Math.random();
                HDialog.Open('300', '500', strPage, '选择流程分类', false, function callback(_Data) {
                    if (_Data != '') {
                        var obj = JSON.parse(_Data);
                        document.getElementById("WorkFlowId").value = obj[0].toString();
                        document.getElementById("WorkFlowIdName" + str).value = obj[1].toString();
                    }
                });
            }
            function btnClear() {
                $("#ContractMoneyStart").numberbox('setValue', "");
                $("#ContractMoneyEnd").numberbox('setValue', "");
                $("#PlanMoneyStart").numberbox('setValue', "");
                $("#PlanMoneyEnd").numberbox('setValue', "");
                $("#PaymentMoneyStart").numberbox('setValue', "");
                $("#PaymentMoneyEnd").numberbox('setValue', "");
                $("#LoanMoneyStart").numberbox('setValue', "");
                $("#LoanMoneyEnd").numberbox('setValue', "");
                $("#WorkFlowId").val("");
                $("#WorkFlowIdName1").val("");
                $("#WorkFlowIdName2").val("");
                $("#WorkFlowIdName3").val("");
                $("#WorkFlowIdName4").val("");
                $("#WorkFlowIdName5").val("");
                $("#WorkFlowIdName6").val("");
                $("#WorkFlowIdName7").val("");
                $("#WorkFlowIdName8").val("");
                $("#SupplierType").val("");
                $("#ContractId").val("");
                $("#PaymentType").val("");
                $("#LoanType").val("");
                $("#CastName6").val("");
                $("#CastName7").val("");
                $("#CastName8").val("");
            }
            function InitTableHeight() {
                var h = $(window).height();
                $("#TableContainer").css("height", h + "px");
            }
            function pageEdit(Id) {
                HDialog.Open('550', '250', '../CostManageNew/CostProcessFlowSet.aspx?OpType=Edit&ID=' + Id + '&TypeCode=' + $("#TypeCode").val(), '修改', true, function callback(_Data) {
                    if (_Data != "") {//**获得返回的参数信息
                        LoadList();
                    }
                });
            }
            InitTableHeight();
            var frozenColumns = [[
                { field: 'Id', title: 'ID', width: 25, align: 'left', sortable: true, hidden: true },
                {
                    field: 'TypeCode', title: '审批类型', width: 120, align: 'left', sortable: true, formatter: function (value, row, index) {
                        var str = "<a class=\"HrefStyle\" onclick=\"pageEdit('" + row.Id + "')\">";
                        switch (row.TypeCode) {
                            case "0710":
                                str += "供方评审";
                                break;
                            case "0701":
                                str += "合同评审审批";
                                break;
                            case "0702":
                                str += "合同变更审批";
                                break;
                            case "0703":
                                str += "合同终止审批";
                                break;
                            case "0705":
                                str += "资金计划审批";
                                break;
                            case "0706":
                                str += "支付审批";
                                break;
                            case "0707":
                                str += "借款审批";
                                break;
                            case "1001":
                                str += "预算计划审批";
                                break;
                            case "1002":
                                str += "预算调整审批";
                                break;
                            case "1003":
                                str += "预算执行审批";
                                break;
                        }
                        str += "</a>";
                        return str;
                    }
                }
                //,
                //
            ]];
            function colomsShow() {
                switch ($("#TypeCode").val()) {
                    case "0710":
                        frozenColumns[0].push(eval('({ field: \'SupplierTypeName\', title: \'供方类别\', width: 120, align: \'left\', sortable: true })'));
                        break;
                    case "0701":
                        frozenColumns[0].push(eval('({ field: \'ContractName\', title: \'合同类型\', width: 120, align: \'left\', sortable: true })'));
                        frozenColumns[0].push(eval('({ field: \'ContractMoney\', title: \'合同金额\', width: 150, align: \'left\', sortable: true, formatter: function (value, row, index) {return row.ContractMoneyStart+" 至 "+row.ContractMoneyEnd;} })'));
                        break;
                    case "0702":
                        frozenColumns[0].push(eval('({ field: \'ContractName\', title: \'合同变更类型\', width: 120, align: \'left\', sortable: true })'));
                        frozenColumns[0].push(eval('({ field: \'ContractMoney\', title: \'合同金额\', width: 150, align: \'left\', sortable: true, formatter: function (value, row, index) {return row.ContractMoneyStart+" 至 "+row.ContractMoneyEnd;} })'));
                        break;
                    case "0703":
                        frozenColumns[0].push(eval('({ field: \'ContractName\', title: \'合同类型\', width: 120, align: \'left\', sortable: true })'));
                        frozenColumns[0].push(eval('({ field: \'ContractMoney\', title: \'合同金额\', width: 150, align: \'left\', sortable: true, formatter: function (value, row, index) {return row.ContractMoneyStart+" 至 "+row.ContractMoneyEnd;} })'));
                        break;
                    case "0705":
                        frozenColumns[0].push(eval('({ field: \'PlanMoney\', title: \'计划金额\', width: 150, align: \'left\', sortable: true , formatter: function (value, row, index) {return row.PlanMoneyStart+" 至 "+row.PlanMoneyEnd;}})'));
                        break;
                    case "0706":
                        frozenColumns[0].push(eval('({ field: \'ContractName\', title: \'合同类别\', width: 120, align: \'left\', sortable: true })'));
                        frozenColumns[0].push(eval('({ field: \'PaymentMoney\', title: \'请付金额\', width: 150, align: \'left\', sortable: true, formatter: function (value, row, index) {return row.PaymentMoneyStart+" 至 "+row.PaymentMoneyEnd;}})'));
                        frozenColumns[0].push(eval('({ field: \'HaveChargePlan\', title: \'资金计划\', width: 120, align: \'left\', sortable: true, formatter: function (value, row, index) {var result = "无";if (row.HaveChargePlan == "1") {result = "有";}return result;} })'));
                        break;
                    case "0707":
                        frozenColumns[0].push(eval('({ field: \'LoanTypeName\', title: \'借款类型\', width: 120, align: \'left\', sortable: true })'));
                        frozenColumns[0].push(eval('({ field: \'LoanMoney\', title: \'借款金额\', width: 150, align: \'left\', sortable: true, formatter: function (value, row, index) {return row.LoanMoneyStart+" 至 "+row.LoanMoneyEnd;}})'));
                        break;
                    case "1001":
                        frozenColumns[0].push(eval('({ field: \'CostCompanyName\', title: \'单位\', width: 180, align: \'left\', sortable: true })'));
                        break;
                    case "1002":
                        frozenColumns[0].push(eval('({ field: \'CostCompanyName\', title: \'单位\', width: 180, align: \'left\', sortable: true })'));
                        frozenColumns[0].push(eval('({ field: \'CostCategory\', title: \'调整类别\', width: 80, align: \'left\', sortable: true })'));
                        break;
                    case "1003":
                        frozenColumns[0].push(eval('({ field: \'CostCompanyName\', title: \'单位\', width: 180, align: \'left\', sortable: true })'));
                        break;
                }
                LoadList();
            }
            var column = [[

                { field: 'WorkFlowIdName', title: '流程名称', width: 45, align: 'left', sortable: true }
                ,
                { field: 'Remark', title: '备注', width: 45, align: 'left', sortable: true }
            ]];

            var toolbar = [
                {
                    text: '新增',
                    iconCls: 'icon-add',
                    handler: function () {
                        HDialog.Open('550', '250', '../CostManageNew/CostProcessFlowSet.aspx?OpType=insert&TypeCode=' + $("#TypeCode").val(), '新增', true, function callback(_Data) {
                            if (_Data != "") {//**获得返回的参数信息
                                LoadList();
                            }
                        });
                    }
                }
                , '-',
                {
                    text: '修改',
                    iconCls: 'icon-edit',
                    handler: function () {
                        var row = $("#TableContainer").datagrid("getSelected");
                        if (row == null) {
                            $.messager.alert("提示", "请选择需要修改的数据!");
                            return;
                        }
                        pageEdit(row["Id"].toString());

                    }
                }
                , '-',

                {
                    text: '删除',
                    iconCls: 'icon-cancel',
                    handler: function () {
                        var row = $("#TableContainer").datagrid("getSelected");
                        if (row == null) {
                            $.messager.alert("提示", "请选择删除数据");
                            return;
                        }
                        DelRecord(row["Id"].toString());
                    }
                }, '-',
                {
                    text: '筛选',
                    iconCls: 'icon-filter',
                    handler: function () {
                        var TypeCode = $("#TypeCode").val();
                        $("#ContractType").html("合同类型");
                        switch (TypeCode) {
                            case "0710":
                                $('#SearchDlg1').parent().appendTo($("form:first"))
                                $('#SearchDlg1').dialog('open');
                                break;
                            case "0701":
                                $('#SearchDlg2').parent().appendTo($("form:first"))
                                $('#SearchDlg2').dialog('open');
                                break;
                            case "0702":
                                $("#ContractType").html("合同变更类型");
                                $('#SearchDlg2').parent().appendTo($("form:first"))
                                $('#SearchDlg2').dialog('open');
                                break;
                            case "0703":
                                $('#SearchDlg2').parent().appendTo($("form:first"))
                                $('#SearchDlg2').dialog('open');
                                break;
                            case "0705":
                                $('#SearchDlg3').parent().appendTo($("form:first"))
                                $('#SearchDlg3').dialog('open');
                                break;
                            case "0706":
                                $('#SearchDlg4').parent().appendTo($("form:first"))
                                $('#SearchDlg4').dialog('open');
                                break;
                            case "0707":
                                $('#SearchDlg5').parent().appendTo($("form:first"))
                                $('#SearchDlg5').dialog('open');
                                break;
                            case "1001":
                                //预算计划
                                $('#SearchDlg6').parent().appendTo($("form:first"))
                                $('#SearchDlg6').dialog('open');
                                break;
                            case "1002":
                                //预算调整
                                $('#SearchDlg7').parent().appendTo($("form:first"))
                                $('#SearchDlg7').dialog('open');
                                break;
                            case "1003":
                                //预算执行
                                $('#SearchDlg8').parent().appendTo($("form:first"))
                                $('#SearchDlg8').dialog('open');
                                break;
                        }

                    }
                }
            ];

            function DelRecord(Id) {
                $.messager.confirm('确定', '是否删除该项', function (r) {
                    if (r) {
                        $.tool.DataGet('CsCost', 'DelCostWorkFlow', 'Id=' + Id,
                            function Init() {
                            },
                            function callback(_Data) {
                                LoadList();

                            },
                            function completeCallback() {
                            },
                            function errorCallback() {
                            });
                    }
                });
            }
            function LoadList() {
                $("#TableContainer").datagrid({
                    url: '/HM/M_Main/HC/DataGetControl.aspx?Method=DataGet&Class=CsCost&Command=GetCostWorkFlow&' + $('#FrmFrom').serialize(),
                    method: "get",
                    title: '',
                    loadMsg: '数据加载中,请稍候...',
                    nowrap: false,
                    pageSize: top.ListPageSize,
                    pageList: top.ListPageList,
                    frozenColumns: frozenColumns,
                    columns: column,
                    fitColumns: true,
                    singleSelect: true,
                    pagination: true,
                    width: "100%",
                    rownumbers: true,
                    border: false,
                    toolbar: toolbar,
                    sortOrder: "asc"

                });
                $("#SearchDlg1").dialog("close");
                $("#SearchDlg2").dialog("close");
                $("#SearchDlg3").dialog("close");
                $("#SearchDlg4").dialog("close");
                $("#SearchDlg5").dialog("close");
                $("#SearchDlg6").dialog("close");
                $("#SearchDlg7").dialog("close");
                $("#SearchDlg8").dialog("close");
            }
            $(function () {
                InitTableHeight();
                colomsShow();
            });
        </script>
    </form>
</body>
</html>

