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

<!DOCTYPE html>

<html>
<head>
    <title></title>
    <script type="text/javascript" src="../Jscript-Ui/jquery-easyui-1.4.4/jquery.min.js"></script>
    <script src="../jscript/jquery.tool.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>
    <script src="../jscript/Dialog.js" type="text/javascript"></script>
    <link href="../css/framesearch.css" type="text/css" rel="stylesheet" />
    <style type="text/css">
        body {
            margin: 0px;
            margin-top: 0px;
            overflow: hidden;
            background-color: #ffffff;
        }

        .Container {
            width: 100%;
            font-size: 12px;
            font-family: 微软雅黑;
        }

        .ContainerLeft {
            float: left;
            overflow-y: auto;
            border-right: 1px solid #cccccc;
        }

        .ContainerRight {
            float: left;
            width: 75%;
            overflow: auto;
        }
    </style>
</head>
<body>
    <form id="FrmForm">
        <input id="LiveType" name="LiveType" type="hidden" runat="server" />
        <input id="IsHis" name="IsHis" type="hidden" runat="server" />

        <div id="ContainerRight" class="ContainerRight">
            <div>
                <div id="SearchDlg" class="easyui-dialog" title="筛选条件" data-options="iconCls:'icon-search',closed: true,modal:true"
                    style="width: 400px; height: 100px;">
                    <table style="width: 100%;">
                        <tr>
                            <td class="TdTitle">房屋编号
                            </td>
                            <td class="TdContent">
                                <input type="text" class="easyui-validatebox" id="CustName" name="RoomSign"
                                    runat="server" />
                            </td>
                            <td class="TdTitle">房屋名称
                            </td>
                            <td class="TdContent">
                                <input type="text" class="easyui-validatebox" id="RoomName" name="RoomName"
                                    runat="server" />
                            </td>
                        </tr>
                        <tr>
                            <td align="center" colspan="4">
                                <a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-search'" onclick="LoadList();">确定筛选</a>
                            </td>
                        </tr>
                    </table>
                </div>
                <div style="width: 100%;" id="TableContainer"></div>
            </div>
        </div>
        <input type="hidden" id="CommID" name="CommID" />

        <input type="hidden" id="UnitSNum" name="UnitSNum" />
        <input type="hidden" id="FloorSNum" name="FloorSNum" />

        <script src="../jscript/CloseAjaxCache.js" type="text/javascript"></script>
        <script type="text/javascript">
            function NodeItemClick(node) {
                // parent.$("#TableContainer").attr("src", "OrganCode=" + $("#LiveTypeName").val(node.attributes.LiveTypeName) + "&OpType=edit&CommID=" + $("#CommID").val(node.attributes.InPopedom));
                LoadList();
            }

            function InitFunction() {
                var h = $(window).height();
                var w = $(window).width() * 0.25 - 1;
                $("#RoomFrameTree").css("width", w + "px");
                $("#RoomFrameTree").css("height", h + "px");
                $("#TableContainer").css("height", h + "px");
            }
            InitFunction();

            var column = [[
                    { field: 'RoomSign', title: '房屋编号', width: 250, align: 'left', sortable: true },
                    { field: 'CustName', title: '客户名称', width: 250, align: 'left', sortable: true },
                    { field: 'BuildArea', title: '建筑面积', width: 250, align: 'left', sortable: true },
                    { field: 'RoomName', title: '房屋名称', width: 200, align: 'left', sortable: true }
            ]];

            var toolbar = [
                 {
                     text: '筛选',
                     iconCls: 'icon-search',
                     handler: function () {
                         $('#SearchDlg').parent().appendTo($("form:first"))
                         $('#SearchDlg').dialog('open');
                     }
                 }
            ];

            function LoadList() {
                $("#TableContainer").datagrid({
                    url: '/HM/M_Main/HC/DataGetControl.aspx?Method=DataGet&Class=Room&Command=waitsplitroomsearch&' + $('#FrmForm').serialize(),
                    method: "get",
                    loadMsg: '数据加载中,请稍候...',
                    nowrap: false,
                    pageSize: 15,
                    pageList: [15, 30, 60],
                    columns: column,
                    fitColumns: true,
                    singleSelect: true,
                    border: false,
                    pagination: true,
                    width: "100%",
                    toolbar: toolbar,
                    sortOrder: "asc",
                    onDblClickRow: function (rowIndex, rowData) {
                        HDialog.ReturnIsJson = true;

                        HDialog.Close(rowData);
                    },
                    onLoadSuccess: function (data) {

                    }
                });
                $("#SearchDlg").dialog("close");
                $("#Room").val();
                $("#FloorSNum").val();
            }

            $(document).ready(function () {
                function InitLeftTree() {
                    $.tool.DataGet('Room', 'buildtree', $('#FrmForm').serialize(),
                            function Init() {
                            },
                            function callback(_Data) {
                                if (_Data != '') {

                                    var stringArray = _Data.split("|");
                                    if (stringArray[0] == "true") {
                                        var data = stringArray[1];
                                        varObjects = eval("(" + data.replace(/\\/g, "/") + ")"); //转换为json对象
                                        GetTree(varObjects);
                                    }
                                    else { $('#lbHint').val(stringArray[1]); }

                                }
                            },
                            function completeCallback() {
                            },
                            function errorCallback() {
                            });
                }

                function GetTree(obj) {
                    $('#treeDemo').html("");
                    $("#UnitSNum").val();
                    $("#FloorSNum").val();
                    $('#treeDemo').tree({
                        data: obj,
                        onClick: function (node) {
                            //alert(node.attributes.LiveTypeName);

                            $("#UnitSNum").val(node.attributes.UnitSNum);
                            $("#FloorSNum").val(node.attributes.FloorSNum);
                            LoadList();

                        }
                    });
                    LoadList();
                }
                InitLeftTree();


                $("#BuildSNum").combobox({
                    onChange: function (newvalue, oldvalue) {

                        $.ajax({
                            url: '/HM/M_Main/HC/DataGetControl.aspx?Method=DataGet&Class=Room&Command=buildtree&BuildSNum=' + newvalue + '&hiCommID=' + $('#hiCommID').val(),
                            type: 'get',
                            dataType: 'text',
                            cache: false,
                            async: true,
                            success: function (_Data) {
                                if (_Data != '') {

                                    var stringArray = _Data.split("|");
                                    if (stringArray[0] == "true") {
                                        var data = stringArray[1];
                                        varObjects = eval("(" + data.replace(/\\/g, "/") + ")"); //转换为json对象
                                        GetTree(varObjects);
                                    }
                                    else { $('#lbHint').val(stringArray[1]); }

                                }
                            },
                            complete: function (XMLHttpRequest, textStatus, errorThrown) {

                            },
                            error: function (XMLHttpRequest, textStatus, errorThrown) {
                            }
                        });

                    }
                });
            });

        </script>
    </form>
</body>
</html>
