<%@ Page Language="C#" AutoEventWireup="true" CodeFile="InventoryClass_Tree.aspx.cs" Inherits="Base_InventoryClass_InventoryClass_Tree" Debug="true" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
    <script src="../../Scripts/EasyUI/jquery-1.8.0.min.js" type="text/javascript"></script>
    <script src="../../Scripts/EasyUI/jquery.easyui.min.js" type="text/javascript"></script>
    <script src="../../Scripts/dtree/dtree.js" type="text/javascript"></script>
    <link rel="stylesheet" type="text/css" href="../../Scripts/EasyUI/themes/default/easyui.css" />
    <link rel="stylesheet" type="text/css" href="../../Scripts/EasyUI/themes/icon.css"/>
    <link href="../../Scripts/dtree/dtree.css" rel="stylesheet" type="text/css" />
    <link href="../../Styles/WebSite.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript">
        //选择分类
        function SelectCategory(cate) {
            parent.category = cate;
            parent.search_grid();
        }
        //新增
        function add() {
            var parent_id = parent.category;
            parent.asyncbox.open({
                id: 'win_modify',
                url: 'InventoryClass_Edit.aspx?action=Add&parent_id=' + parent_id,
                modal: true,
                title: '新增分类'
            });
        }
        //修改
        function modify() {
            var id = parent.category;
            if (id.length == 0) {
                parent.AlertNO('请选择要查看的记录!');
                return;
            }
            parent.asyncbox.open({
                id: 'win_modify',
                url: 'InventoryClass_Edit.aspx?action=Update&id=' + id,
                modal: true,
                title: '修改分类'
            });

        }
        //删除
        function del() {
            var id = parent.category;
            if (id.length == 0) {
                AlertNO('请选择要删除的记录!');
                return;
            }
            parent.asyncbox.confirm('确定要删除吗', '警告', function (buttonResult) {
                if (buttonResult == "ok") {
                    parent.ShowLoadingMask(); //显示遮罩
                    $.ajax({
                        type: "POST",
                        contentType: "application/json",
                        url: "InventoryClass_Service.asmx/Delete",
                        data: "{ids:'" + id + "'}",
                        dataType: 'json',
                        success: function (result) {
                            var r = result.d;
                            if (r == "success") {
                                parent.AlertOK('删除成功!');
                                parent.load_tree();
                            } else {
                                parent.AlertNO(r);
                            }
                            parent.HideLoadingMask(); //关闭遮罩
                        }
                    });
                }
            });
        }
    </script>
</head>
    <body>
    <!--工具栏-->
    <div style="height:30px;" class="list_menu_bar">
        <a plain="true" class="easyui-linkbutton" onclick="add()" style='<%=auth.AuthView("Base_InventoryClass_Edit")%>'>新增</a>
        <a plain="true" class="easyui-linkbutton" onclick="modify()">修改</a>
        <a plain="true" class="easyui-linkbutton" onclick="del()" style='<%=auth.AuthView("Base_InventoryClass_Delete")%>'>删除</a>
    </div>
    <%=xview["dtree"]%>
    </body>
</html>
