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

<!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" />
    <link href="../images/style.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript" src="../../scripts/jquery/jquery-1.8.3.min.js"></script>
    <script type="text/javascript" src="../../scripts/jquery/jquery.form.js"></script>
    <script type="text/javascript" src="../../scripts/jquery/jquery.validate.min.js"></script>
    <script type="text/javascript" src="../../scripts/jquery/messages_cn.js"></script>
    <script type="text/javascript" src="../../scripts/ui/js/ligerBuild.min.js"></script>
    <script type="text/javascript" src="../../scripts/function.js"></script>
    <%--<script src="../scripts/calendar.js" type="text/javascript"></script>--%>
    <script src="../scripts/ui/js/core/base.js" type="text/javascript"></script>
    <script src="../scripts/ui/js/plugins/ligerDialog.js" type="text/javascript"></script>
    <script src="../scripts/ui/js/plugins/ligerDrag.js" type="text/javascript"></script>
    <script src="../scripts/ui/js/plugins/ligerSpinner.js" type="text/javascript"></script>
    <script src="../scripts/ui/js/plugins/ligerTree.js" type="text/javascript"></script>
    <script src="../scripts/ui/js/plugins/ligerComboBox.js" type="text/javascript"></script>
    <script type="text/javascript">
        var treelist = null;
        $(function () {
            $("#txtF_Sort").ligerSpinner({ height: 28, type: 'int' });
            treelist = $("#dropF_Category").ligerComboBox({
                width: 130,
                selectBoxWidth: 200,
                selectBoxHeight: 150, valueField: 'id', resize: false, treeLeafOnly: false,
                tree: {
                    url: 'ajax/deptcategory.ashx?action=gettreelist',
                    width: 200,
                    height: 150,
                    checkbox: false,
                    ajaxType: 'get',
                    onSuccess: function (data) { SetTreeValue(); }
                }
            });

            //treelist.setText();
        });
        function SetTreeValue() {
            try {
                treelist.setValue(document.getElementById("txtF_ParentId").value);
                if (document.getElementById("txtF_ParentId").value == "" || document.getElementById("txtF_ParentId").value == "0") {
                    treelist.setText("顶级分类");
                }
            }
            catch (e) {
              
             }
        }
        function validatelogin_name() {
            document.getElementById("txtF_ParentId").value = treelist.getValue();
            if ($("#txtF_ParentId").val() == "") {
                document.getElementById("lbParent").innerHTML = "* 不允许为空！";
                document.getElementById("lbParent").style.color = "red";
                $.ligerDialog.error('所属分类不允许为空');
                return false;
            }
            else {
                document.getElementById("lbParent").innerHTML = "*";
                document.getElementById("lbParent").style.color = "#414141";
            }
            if ($("#txtF_CategoryName").val() == "") {
                document.getElementById("lbF_CategoryName").innerHTML = "* 不允许为空！";
                document.getElementById("lbF_CategoryName").style.color = "red";
                $.ligerDialog.error('名称不允许为空');
                return false;
            }
            else {
                document.getElementById("lbF_CategoryName").innerHTML = "*";
                document.getElementById("lbF_CategoryName").style.color = "#414141";
                return true;
            }
        }
        function validate() {
            var i = 0;
            if (!validatelogin_name()) {
                i++;
            }
            if (i > 0) {
                return false;
            }
            return true;
        }

        function CloseThis() {
            var dialog = frameElement.dialog;
            parent.InitCategory();
            dialog.close();
        }
        function SaveInfo(res) {
            switch (res) {
                case 'success':
                    $.ligerDialog.success('保存成功', function (yes) { CloseThis();});
                    break;
                case 'warn':
                    $.ligerDialog.error('保存失败，请确认数据正确性');
                    break;
                case 'error':
                    $.ligerDialog.error('系统错误，请联系开发商');
                    break;
                default:
                    break;
            }
        }
    </script>
</head>
<body  class="mainbody" scroll="no" style="margin-top: 0px;">
    <form id="form1" runat="server">
    <div id="contentTab">
        <%--<ul class="tab_nav">
            <li class="selected"><a onclick="tabs('#contentTab',0);" href="javascript:;">部门信息</a></li>
        </ul>--%>
        <div class="tab_con" style="display: block;">
            <table class="form_table">
                <col width="100px" />
                <col />
                <tbody>
                    <tr>
                        <th>
                            所属部门：<asp:HiddenField ID="txtF_ParentId" Value="" runat="server" />
                            <asp:HiddenField ID="txtF_CategoryId" Value="" runat="server" />
                        </th>
                        <td>
                            <div style="float:left;"><asp:TextBox ID="dropF_Category" runat="server"></asp:TextBox></div><div style="float:left;"><label
                                id="lbParent" for="txtF_CategoryId">*</label></div>
                        </td>
                    </tr>
                    <tr>
                        <th>
                            部门名称：
                        </th>
                        <td>
                            <asp:TextBox ID="txtF_CategoryName" runat="server" CssClass="txtInput normal" Style="width: 120px;"></asp:TextBox><label
                                id="lbF_CategoryName" for="txtF_CategoryName">*</label>
                        </td>
                    </tr>
                    <tr>
                        <th>
                            排列序号：
                        </th>
                        <td>
                            <asp:TextBox ID="txtF_Sort" runat="server" Style="width: 120px;"></asp:TextBox>
                        </td>
                    </tr>
                </tbody>
            </table>
        </div>
        <div class="foot_btn_box">
            <asp:Button ID="btnSubmit" runat="server" Text="保&nbsp;&nbsp;存" CssClass="btnSubmit"
                OnClientClick="return validate();" OnClick="btnSubmit_Click" />
        </div>
    </div>
    </form>
</body>
</html>
