<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="alarmmanage.aspx.cs" Inherits="HySoft.BaseCallCenter.Web.workordermanage.workorderset.alarmmanage" %>

<!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 runat="server">
    <title>告警超时设置</title>
    <link href="../../scripts/ui/skins/Aqua/css/ligerui-all.css" rel="stylesheet" type="text/css" />
    <script src="../../scripts/jquery/jquery-1.3.2.min.js" type="text/javascript"></script>
    <script src="../../scripts/ui/json2.js" type="text/javascript"></script>
    <script src="../../scripts/ui/js/core/base.js" type="text/javascript"></script>
    <script src="../../scripts/ui/js/ligerui.min.js" type="text/javascript"></script>
    <link href="../../scripts/ui/skins/Tab/css/tab.css" rel="stylesheet" type="text/css" />
    <link href="../../scripts/ui/skins/Tab/css/grid.css" rel="stylesheet" type="text/css" />
    <script src="../../scripts/ui/js/plugins/ligerGrid.js" type="text/javascript"></script>
    <script src="../../scripts/ui/js/plugins/ligerLayout.js" type="text/javascript"></script>
    <script src="../../scripts/ui/js/plugins/ligerTree.js" type="text/javascript"></script>
    <script src="../../scripts/ui/js/plugins/ligerMenu.js" type="text/javascript"></script>
    <script src="../../scripts/CustomersData.js" type="text/javascript"></script>
    <link href="../../scripts/ui/skins/ligerui-icons.css" rel="stylesheet" type="text/css" />
    <link href="../../images/style.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript">
        var singleClick;
        var gridlist;
        var actionNodeID;
        var parentId;
        var gridstatelist;
        $(function () {
            $("#layout1").ligerLayout({
                leftWidth: 200,
                allowCenterBottomResize: false
            });
            tree();
            InitList();
        });
        function tree() {
            $("#tree1").ligerTree({
                nodeWidth: 135,
                checkbox: false,
                url: '../ajax/WorkalarmmangeAjax.ashx?action=gettreelist',
                onClick: function (node, e) {
                    actionNodeID = node.data.id;
                    parentId = node.data.IconCls;
                    InitList();
                }
            });
        }
        function InitList() {
            try {
                gridlist = $("#divTypeList").ligerGrid({
                    checkbox: true,
                    height: '99%',
                    columns: [
                { display: 'ID', name: '_f_id', width: '1%', hide: 'true' },
                           { display: '类型名称', name: '_f_name', width: '20%' },
                                      { display: '告警时限', name: '_gaojingtime', width: '20%' },
                                    { display: '超时时限', name: '_chaoshitime', width: '42%' }
                ],
                    url: '../ajax/WorkalarmmangeAjax.ashx?action=getlist&ActionNodeIds=' + actionNodeID, pageSize: 10, rownumbers: true,
                    onSelectRow: function (data, rowindex, rowobj) {
                    },
                    onSuccess: function (data, grid) {
                       
                    }

                });
            
                gridstatelist = $("#divStateList").ligerGrid({
                    checkbox:true,
                    height: '99%',
                    columns: [
                { display: 'ID', name: '_f_id', width: '1%', hide: 'true' },
                 { display: '状态名称', name: '_f_name', width: '20%' },
                                      { display: '告警时限', name: '_gaojingtime', width: '20%' },
                                    { display: '超时时限', name: '_chaoshitime', width: '42%' }
                ],
                    url: '../ajax/WorkalarmmangeAjax.ashx?action=getstatelist', pageSize: 10, rownumbers: true,
                    onSelectRow: function (data, rowindex, rowobj) {
                    },
                    onSuccess: function (data, grid) {
                       
                    }

                });
                
            }
            catch (e) {
                alert(e.Message);
            }
            gridlist.changePage('first');
            $("#pageloading").hide();
        }
        function AddType() {
            var rows = gridlist.getSelectedRows();
            var typeFlg;
             if (rows != null && rows.length != 0) {
                 if (rows.length > 0 && rows.length < 2) {
                     if (rows[0]._f_id == 0) {
                         typeFlg = "add";
                     } else {
                         typeFlg = "edit";
                     }
                    $.ligerDialog.open({ url: 'alarmmangeTypeEdit.aspx?action='+typeFlg+'&f_id=' + rows[0]._f_id + '&f_worktypeId=' + rows[0]._f_workordertypeid, title: '设置类型超时', height: 330, width: 450, isResize: true });
              }else{
               $.ligerDialog.alert('最多设置一条记录!！');
              }
             }else{
             $.ligerDialog.alert('请先选择要设置超时的类型！');
             }
        }

        function AddState() {
            var rows = gridstatelist.getSelectedRows();
            var typeFlg;
            if (actionNodeID != "" && actionNodeID != undefined) {
                if (rows != null && rows.length != 0) {
                    if (rows.length > 0 && rows.length < 2) {
                        if (rows[0]._f_id == 0) {
                            typeFlg = "add";
                        } else {
                            typeFlg = "edit";
                        }
                        $.ligerDialog.open({ url: 'alamangeStateEdit.aspx?action=' + typeFlg + '&f_id=' + rows[0]._f_id + '&f_workstateId=' + rows[0]._f_workorderstateid + '&f_worktypeid=' + actionNodeID, title: '设置类型超时', height: 330, width: 450, isResize: true });
                    } else {
                        $.ligerDialog.alert('最多设置一条记录!！');
                    }
                } else {
                    $.ligerDialog.alert('请先选择要设置超时的状态！');
                }
            } else {
                $.ligerDialog.alert('请先选择类型！');
            }
        }

    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div id="layout1">
        <div position="left" title="类型信息">
            <ul id="tree1">
                <li isexpand="false" id="-1"><span>类型信息</span>
                    <ul>
                    </ul>
                </li>
            </ul>
        </div>
        <div class="l-layout-center" style="left: 205px; width: 400px; height: 98%;">
            <div class="tools_bar">
            <a class="tools_btn" href="#" onclick="AddType();">
            <span><b class="AddType">设置</b></span>
            </a>
            </div>
            <div class="l-layout-header">
                类型超时设置</div>
                <div id="divTypeList">
                
            </div>
        </div>
        <div class="l-layout-right" style="left: 610px; width: 380px; height: 98%;">
          <div class="tools_bar">
            <a class="tools_btn" href="#" onclick="AddState();">
            <span><b class="AddState">设置</b></span>
            </a>
            </div>
            <div class="l-layout-header">
                状态超时设置
            </div>
            <div id="divStateList">
            </div>
        </div>
    </div>
    </form>
</body>
</html>
